home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Freelog 125
/
Freelog_MarsAvril2015_No125.iso
/
Musique
/
Quod Libet
/
quodlibet-3.3.0-installer.exe
/
bin
/
quodlibet
/
ext
/
events
/
radioadmute.pyc
(
.txt
)
< prev
next >
Wrap
Python Compiled Bytecode
|
2014-12-31
|
2KB
|
60 lines
# Source Generated with Decompyle++
# File: in.pyc (Python 2.7)
import re
from quodlibet import app
from quodlibet.util import re_escape
from quodlibet.plugins.events import EventPlugin
class RadioAdMute(EventPlugin):
PLUGIN_ID = 'radio_ad_mute'
PLUGIN_NAME = _('Mute radio ads')
PLUGIN_VERSION = '0.1'
PLUGIN_DESC = _('Mute while radio advertisements are playing.\nStations: di.fm')
SPAM = [
'www.webex.co.uk',
'di.fm/premium',
"There's more to Digitally Imported!",
'Digitally Imported AMTAG_60 ADWTAG_30000_START=0',
'Digitally Imported TSTAG_60 ADWTAG',
'PhotonVPS.com',
'Get Digitally Imported Premium',
'More of the show after these messages',
'Choose premium for the best audio experience',
'www.di.fm/jobs']
RE_SPAM = [
'Sponsored Message\\s+\\([0-9]+\\)']
SPAM = map(re_escape, SPAM) + RE_SPAM
SPAM = [ re.compile(s, re.I) for s in SPAM ]
__old_volume = 0
__muted = False
def disabled(self):
self.plugin_on_song_ended()
def plugin_on_song_started(self, song):
if not song or not (song.streamsong):
return None
player = None.player
data = song('~title~artist')
for spam in self.SPAM:
if spam.search(data):
self._RadioAdMute__old_volume = player.volume
self._RadioAdMute__muted = True
player.volume = 0
break
continue
def plugin_on_song_ended(self, *args):
if not self._RadioAdMute__muted:
return None
self._RadioAdMute__muted = None
player = app.player
if player.volume != 0:
return None
player.volume = None._RadioAdMute__old_volume